package com.atldy.commerce.service;

import com.atldy.commerce.service.hystrix.OpenfeignTokenServiceFallbackFactory;
import com.atldy.commerce.vo.JwtToken;
import com.atldy.commerce.vo.UsernameAndPassword;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @version 1.0
 * @Author: li-dong-yang
 * @CreateTime: 2021-08-25 6:20
 * @Description： feign client
 */
@FeignClient(contextId = "OpenfeignTokenService"
        , value = "e-commerce-authority-center"
        //,fallback = OpenfeignTokenServiceFallback.class
        ,fallbackFactory = OpenfeignTokenServiceFallbackFactory.class
)
@Service
public interface OpenfeignTokenService {

    @PostMapping(value = "/ecommerce-authority-center/authority/token"
            , consumes = MediaType.APPLICATION_JSON_VALUE
            , produces = MediaType.APPLICATION_JSON_VALUE)
    JwtToken getOpenfeignToken(@RequestBody UsernameAndPassword usernameAndPassword);

}
